sprintf(txt,"%sThe analysed signal exceeds the normal range between -32768.0 and 32767.0\nIt might clip in the following effect and it will clip if connected to master output.\n",txt);
tmp=(float)16384.0*(tmp_maxrange/tmp_max);
if((int)tmp)
{
sprintf(txt,"%sThe input volume slider of the next machine should be set to under %d [%.2f%%].\n",txt,(int)tmp,(100*tmp)/16384 );
} else
{
// the setting would be out of the range of the slider, print a warning
sprintf(txt,"%sThe input volume slider of the next machine CAN NOT BE SET to a value that would prevent clipping.\n -> Set it as small as possible (0 mutes the signal).\n",txt,(int)tmp,(100*tmp)/16384 );
sprintf(txt,"%sThe master output volume slider should have a value over %d [%.2f%%] to prevent clipping.\n",txt,(int)tmp,(100*tmp)/16384);
} else
{
// the setting would be out of the range of the slider, print a warning
sprintf(txt,"%sThe master output volume slider CAN NOT BE SET to a value that would prevent clipping.\n -> Set it as high as possible (16384 mutes the output).\n",txt,(int)tmp,(100*tmp)/16384);
}
} else
{
sprintf(txt,"%sThe analysed signal was in the normal range between -32768.0 and 32767.0. \nThere is no need to adjust the volume sliders.\n",txt);
}
}
void mi::print_time(char *txt,unsigned long samples)
{
unsigned long secs;
unsigned long samplespersec=pMasterInfo->SamplesPerSec;
unsigned long samplespertick=pMasterInfo->SamplesPerTick;
pCB->MessageBox(miMACHINE_NAME"\n\nBuild date: "__DATE__"\nVersion: "miVERSION"\nCoded by: "miMACHINE_AUTHOR"\nThanks to Oskari and other #buzz developers.\n\nCheck out http://www.iki.fi/apo/buzz/\nfor more buzz stuff.\n\nExcellent skin made by Hymax.");
break;
}
}
void mi::MDKInit(CMachineDataInput * const pi)
{
stereo_mode=false;
Command(1);
}
void mi::OutputModeChanged(bool stereo)
{
stereo_mode=stereo;
Command(1);
}
bool mi::MDKWorkStereo(float *psamples, int numsamples, int const mode)
{
float l,r;
double tmp;
if ((mode==WM_WRITE)||(mode==WM_NOIO))
{
return false;
}
if (mode == WM_READ) // <thru>
return true;
do
{
l=psamples[0];
r=psamples[1];
psamples+=2;
left_dcsum+=l;
left_rms+=l*l;
left_avg+=fabs(l);
if(l>left_maxlevelfound)
{
left_maxlevelfound=l;
time_left_maxvalue=dcnum;
}
if(l<left_minlevelfound)
{
left_minlevelfound=l;
time_left_minvalue=dcnum;
}
if(prev_left>=0)
{
if(l<0)
left_zerocross++;
} else
{
if(l>=0)
left_zerocross++;
}
tmp=fabs(l-prev_left);
if(tmp>left_max_change)
{
left_max_change=tmp;
time_left_change=dcnum;
}
prev_left=l;
right_dcsum+=r;
right_rms+=r*r;
right_avg+=fabs(r);
if(r>right_maxlevelfound)
{
right_maxlevelfound=r;
time_right_maxvalue=dcnum;
}
if(r<right_minlevelfound)
{
right_minlevelfound=r;
time_right_minvalue=dcnum;
}
if(prev_right>=0)
{
if(r<0)
right_zerocross++;
} else
{
if(r>=0)
right_zerocross++;
}
tmp=fabs(r-prev_right);
if(tmp>right_max_change)
{
right_max_change=tmp;
time_right_change=dcnum;
}
prev_right=r;
dcnum++;
} while(--numsamples);
return true;
}
bool mi::MDKWork(float *psamples, int numsamples, int const mode)